/*
 * JanelaAluno.java
 *
 * Created on 10 de Agosto de 2009, 21:48
 */

package gui;

import dados.BancoQuestoes;
import dados.QuestaoProva;
import java.util.ArrayList;

import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import versao.Metodos;

/**
 *
 * @author  Yuri Maia
 */
public class JanelaAluno extends javax.swing.JDialog {
    
	private static final long serialVersionUID = 1L;
	/** Creates new form JanelaAluno */
    public JanelaAluno(javax.swing.JFrame parent, boolean modal, String matricula) {
        super(parent, modal);
        initComponents();
        this.setResizable(true);
        this.matricula.setText("Prova " + " - " + matricula);
        Janelas.alinharContainer(this);
        inicializarQuestoes(matricula);
    }

    private void inicializarQuestoes(String mat) {   	    	
        int contador;
        ArrayList<QuestaoProva> questoes = BancoQuestoes.getInstancia().getArrayListQuestaoProva();
        contador = 0;
        for(@SuppressWarnings("unused") QuestaoProva questao : questoes){
        	//System.out.println("TESTE:"+BancoQuestoes.getEscolha());
        	Metodos mv = null;
        	if(BancoQuestoes.getSimulado() == 1){
        		mv = new Metodos(1);
        	}else{
        		mv = new Metodos(4);
        	}
        	int versao = mv.initMetodos(mat, BancoQuestoes.getEscolha());
        	System.out.println("Versao"+versao);
            //int versao = Utilitarios.questaoAleatoria(questao.getArrayListQuestao().size(), matricula);
            JTextArea enunciado = new JTextArea();
            enunciado.setText(BancoQuestoes.getInstancia()
                                .getQuestaoProva(contador)
                                .getQuestao(versao)
                                .getEnunciado());
            enunciado.setEditable(false);
            JScrollPane scrollPane = new JScrollPane();
            scrollPane.setViewportView(enunciado);
            
            contador++;
            
            painelQuestoes.addTab("Questão " + contador, scrollPane);
        }
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        painelQuestoes = new javax.swing.JTabbedPane();
        matricula = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        matricula.setText("jLabel1");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(painelQuestoes, javax.swing.GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE)
                    .addComponent(matricula))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(matricula)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(painelQuestoes, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel matricula;
    private javax.swing.JTabbedPane painelQuestoes;
    // End of variables declaration//GEN-END:variables
    
}
